package com.example.spread.web.controller;

import org.apache.catalina.connector.Request;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * Created by Administrator on 2018/7/31.
 */

@Controller
@RequestMapping("/login")
public class LoginController {

    @RequestMapping("/")
    public String index(){
        return "login/index";
    }

    @RequestMapping(value = "/loginIn" ,method = RequestMethod.POST)
    public String loginIn(@RequestParam(name = "userName") String usrName, @RequestParam(name ="password") String password){
        System.out.println("home/index");
        System.out.println(usrName);
        if (!usrName.equals("admin")){
            return this.index();
        }
        if(!password.equals("123")){
            return this.index();
        }

        return "home/index";
    }

    @RequestMapping("/loginOut")
    public  String loginOut(){
        return this.index();
    }

}
